<div class="header_menu">
    <div class="container">
        <div class="header-nav clearfix">
            <?php echo $this->partial('shop/layout/headerMenu'); ?>
        </div>
    </div>
</div>
</div>
<div class="container breadcrumbs">
    <a href="<?php echo $this->url('shop'); ?>"><?php echo $this->translate('首页'); ?></a>
    <span class="sep">/</span><span><?php echo $this->translate('我的订单'); ?></span>
</div>
<div class="container">
    <div class="uc-full-box">
        <div class="row">
            <div class="span4">
                <?php echo $this->partial('shop/partial/home/leftMenu'); ?>
            </div>
            <div class="span16">
                <div class="xm-line-box uc-box">
                    <h3 class="right-more-title">
                        <form class="form-search" action="" style="margin: 0;" method="get">
                            <input type="hidden" name="orderStatus" value="<?php echo $this->orderStatus; ?>">
                            <?php echo $this->translate('我的订单'); ?>
                            <div class="pull-right">
                                <input type="text" name="search_order_sn" value="<?php echo isset($_GET['search_order_sn']) ? $this->escapehtml($_GET['search_order_sn']) : ''; ?>" placeholder="<?php echo $this->translate('输入订单号'); ?>" style="height:16px;width: 240px;padding-top: 5px;margin-bottom: 3px;">&nbsp;<button type="submit" class="btn btn-primary" style="width: 50px;"><?php echo $this->translate('搜索'); ?></button>
                            </div>
                        </form>
                    </h3>
                    <div class="box-hd-more">
                        <div class="pull-left left-menu-more">
                            <div class="uc-order-list-type">
                                <a <?php if($this->orderStatus == -1) echo 'class="current"'; ?> href="<?php echo $this->url('home-order'); ?>"><?php echo $this->translate('所有订单'); ?></a>
                                <span class="sep">|</span>
                                <a <?php if($this->orderStatus == $this->shopHelper()->getOrderStatusCode('wait_payment')) echo 'class="current"'; ?> href="<?php echo $this->url('home-order', [], ['query' => ['orderStatus' => $this->shopHelper()->getOrderStatusCode('wait_payment')]]); ?>"><?php echo $this->translate('待付款订单'); ?></a>
                                <span class="sep">|</span>
                                <a <?php if($this->orderStatus == $this->shopHelper()->getOrderStatusCode('WAIT_GOODS_ARRIVE') . '-' . $this->shopHelper()->getOrderStatusCode('finish_distribution_goods')) echo 'class="current"'; ?> href="<?php echo $this->url('home-order', [], ['query' => ['orderStatus' => $this->shopHelper()->getOrderStatusCode('WAIT_GOODS_ARRIVE') . '-' . $this->shopHelper()->getOrderStatusCode('finish_distribution_goods')]]); ?>"><?php echo $this->translate('待发货订单'); ?></a>
                                <span class="sep">|</span>
                                <a <?php if($this->orderStatus == $this->shopHelper()->getOrderStatusCode('goods_shipped')) echo 'class="current"'; ?> href="<?php echo $this->url('home-order', [], ['query' => ['orderStatus' => $this->shopHelper()->getOrderStatusCode('goods_shipped')]]); ?>"><?php echo $this->translate('待收货订单'); ?></a>
                                <span class="sep">|</span>
                                <a <?php if($this->orderStatus == $this->shopHelper()->getOrderStatusCode('goods_received') . '-' . $this->shopHelper()->getOrderStatusCode('complete')) echo 'class="current"'; ?> href="<?php echo $this->url('home-order', [], ['query' => ['orderStatus' => $this->shopHelper()->getOrderStatusCode('goods_received') . '-' . $this->shopHelper()->getOrderStatusCode('complete')]]); ?>"><?php echo $this->translate('已完成订单'); ?></a>
                                <span class="sep">|</span>
                                <a <?php if($this->orderStatus == $this->shopHelper()->getOrderStatusCode('cancel_order')) echo 'class="current"'; ?> href="<?php echo $this->url('home-order', [], ['query' => ['orderStatus' => $this->shopHelper()->getOrderStatusCode('cancel_order')]]); ?>"><?php echo $this->translate('无效订单'); ?></a>
                            </div>
                        </div>
                    </div>
                    <div class="box-bd">
                        <?php echo $this->partial('shop/message'); ?>
                        <?php
                        if ($this->orderList->getCurrentItemCount() > 0) {
                            ?>
                            <div class="uc-order-list-box">
                                <ul class="uc-order-detail-list">
                                    <?php foreach ($this->orderList as $orderValue) {
                                        $goodsList = $orderValue->getOrderGoods();
                                        ?>
                                        <li class="uc-order-detail-item">
                                            <table class="order-detail-table">
                                                <thead>
                                                <tr>
                                                    <th colspan="3" class="column-info column-t">
                                                        <div class="column-content">
                                                            <span class="order-status"><?php echo $this->shopHelper()->getOrderStatus($orderValue->getOrderStatus()); ?></span>
                                                            <?php echo $this->translate('订单编号'); ?>：<a href="<?php echo $this->url('home-order', ['action' => 'orderInfo', 'id' => $orderValue->getOrderId()]); ?>"><?php echo $orderValue->getOrderSn(); ?></a>
                                                            <span class="sep">|</span>
                                                            <?php echo $this->escapeHtml($orderValue->getUserName()); ?>
                                                            <span class="sep">|</span>
                                                            <?php echo $this->shopDateFormat()->shopOrderAddTime($orderValue->getOrderAddTime()); ?>
                                                        </div>
                                                    </th>
                                                </tr>
                                                </thead>
                                                <tbody>
                                                <tr>
                                                    <td class="column-detail column-l">
                                                        <ul class="order-goods-list">
                                                            <?php
                                                            foreach($goodsList as $goodsKey => $goodsValue) {
                                                                $goodsName = $this->escapeHtml($goodsValue->getGoodsName());
                                                                ?>
                                                                <li <?php if($goodsKey == 0) echo 'class="first"'; ?>>
                                                                    <a href="<?php echo $this->url('shop-goods', ['id' => $goodsValue->getGoodsId()]); ?>" target="_blank">
                                                                        <img alt="<?php echo $goodsName; ?>" title="<?php echo $goodsName; ?>" src="<?php echo $this->shopHelper()->baseGoodsImagePath($goodsValue->getGoodsImage()); ?>" class="goods-thumb">
                                                                    </a>
                                                                    <a class="goods-name" href="<?php echo $this->url('shop-goods', ['id' => $goodsValue->getGoodsId()]); ?>" target="_blank"><?php echo $goodsName; ?></a>
                                                                    <span class="goods-price"><?php echo $this->shopHelper()->orderCurrency($goodsValue->getGoodsPrice(), $orderValue->getCurrencySymbol()); ?> x <?php echo $goodsValue->getBuyNum(); ?></span>
                                                                    <span style="display: block;"><?php echo $this->escapeHtml($goodsValue->getInSpecGoodsStr()); ?></span>
                                                                    <table>
                                                                        <tr>
                                                                            <td style="border: 0;">
                                                                                <button class="btn btn-small" onclick="window.location.href='<?php echo $this->url('shop-goods', ['id' => $goodsValue->getGoodsId()]); ?>'"><?php echo $this->translate('再次购买'); ?></button>
                                                                                &nbsp;
                                                                            </td>
                                                                            <td style="border: 0;">
                                                                                <?php if($orderValue->getOrderStatus() >= $this->shopHelper()->getOrderStatusCode('GOODS_RECEIVED')) { ?>
                                                                                    &nbsp;
                                                                                    <?php if($goodsValue->getEvaluationStatus() == 0) { ?>
                                                                                        <a style="color: #fff;border:1px;" href="<?php echo $this->url('home-order', ['action' => 'orderGoodsEvaluation', 'id' => $goodsValue->getOrderGoodsId()]); ?>" class="btn btn-small btn-a-url btn-primary"><?php echo $this->translate('尚未评价'); ?></a>
                                                                                    <?php } else { ?>
                                                                                        <a style="color: #fff;border:1px;" href="<?php echo $this->url('home-order', ['action' => 'orderGoodsEvaluation', 'id' => $goodsValue->getOrderGoodsId()]); ?>" class="btn btn-small btn-a-url btn-primary"><?php echo $this->translate('已经评价'); ?></a>
                                                                                    <?php } ?>
                                                                                <?php } ?>
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </li>
                                                                <?php } ?>
                                                        </ul>
                                                    </td>
                                                    <td class="column-price">
                                                        <div class="order-info order-price"><?php echo $this->shopHelper()->orderCurrency($orderValue->getOrderAmount(), $orderValue->getCurrencySymbol()); ?></div>
                                                    </td>
                                                    <td class="column-action column-r">
                                                        <div class="order-info order-action">
                                                            <a href="<?php echo $this->url('home-order', ['action' => 'orderInfo', 'id' => $orderValue->getOrderId()]); ?>"><?php echo $this->translate('订单详情'); ?><i class="iconfont"></i></a>
                                                            <?php if($orderValue->getOrderStatus() == $this->shopHelper()->getOrderStatusCode('wait_payment') && $orderValue->getPaymentType() != 'CashOnDelivery') { ?>
                                                                <button class="btn btn-small btn-primary" onclick="window.location.href='<?php echo $this->url('shop-checkout', ['action' => 'checkoutComplete', 'id' => $orderValue->getOrderId()]); ?>'"><?php echo $this->translate('立即付款'); ?></button>
                                                            <?php } ?>
                                                            <?php if($orderValue->getOrderStatus() == $this->shopHelper()->getOrderStatusCode('WAIT_GOODS_ARRIVE') && $orderValue->getPaymentType() != 'CashOnDelivery') { ?>
                                                                <button class="btn btn-small btn-primary" onclick="window.location.href='<?php echo $this->url('shop-checkout', ['action' => 'checkoutComplete', 'id' => $orderValue->getOrderId()]); ?>'"><?php echo $this->translate('支付尾款'); ?></button>
                                                            <?php } ?>

                                                            <?php
                                                            if($this->shopHelper()->shopCancelOrder($orderValue)) { ?>
                                                                <button class="btn btn-small" onclick="runConfirm('<?php echo $this->translate('您确认要取消该订单吗?'); ?>', '<?php echo $this->url('home-order', ['action' => 'cancelOrder', 'id' => $orderValue->getOrderId()]); ?>');"><?php echo $this->translate('取消订单'); ?></button>
                                                            <?php } ?>

                                                            <?php if($orderValue->getOrderStatus() == $this->shopHelper()->getOrderStatusCode('CANCEL_ORDER')) { ?>
                                                                <button class="btn btn-small" onclick="window.location.href='<?php echo $this->url('home-order', ['action' => 'deleteOrder', 'id' => $orderValue->getOrderId()], ['query' => ['qToken' => $this->shopHelper()->getCsrfValue()]]); ?>'"><?php echo $this->translate('删除订单'); ?></button>
                                                            <?php } ?>

                                                            <?php if($this->shopHelper()->shopReceiptOrder($orderValue)) { ?>
                                                                <?php
                                                                if ($this->shopHelper()->shopOrderExpressTrack($orderValue, $this->deliveryIdArray)) { ?>
                                                                    <a href="<?php echo $this->url('home-order', ['action' => 'orderExpressTrack', 'id' => $orderValue->getOrderId()]); ?>" class="btn btn-small btn-a-url btn-primary" style="width: 116px;color: #fff;" target="_blank"><?php echo $this->translate('查看物流'); ?></a>
                                                                <?php } ?>
                                                                <button type="button" class="btn btn-small btn-primary" onclick="runConfirm('<?php echo $this->translate('您确定要进行收货处理吗?'); ?>', '<?php echo $this->url('home-order', ['action' => 'receiptOrder', 'id' => $orderValue->getOrderId()]); ?>');"><?php echo $this->translate('确认收货'); ?></button>
                                                            <?php } ?>
                                                        </div>
                                                    </td>
                                                </tr>
                                                </tbody>
                                            </table>
                                        </li>
                                    <?php } ?>
                                </ul>
                            </div>
                            <div>
                                <?php echo $this->paginationControl($this->orderList, 'Sliding', 'shop/page', ['route' => 'home-order']); ?>
                            </div>
                        <?php } else { ?>
                            <?php echo $this->translate('暂时无订单!'); ?>
                        <?php } ?>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>